<link rel="Stylesheet" type="text/css" href="<?php echo $base_url ?>style/css/jquery.jmodal.css" />
<script language="javascript" src="<?php echo $base_url ?>style/js/BE/jquery.jmodal.js"></script>
<script>
    var js_url = "<?php echo $base_url; ?>";
    var link_page_name = "<?php echo $link_page_name; ?>";
    var js_pagetitle = "<?php echo $page_title ?>";
</script>
<script language="javascript" src="<?php echo $base_url; ?>style/js/BE/admin_adv.js"></script>
<br />

<!-- begin select date -->
<link rel="stylesheet" type="text/css" media="all" href="<?php echo $base_url ?>style/js/BE/datepicker/jsDatePick_ltr.min.css" />
<script type="text/javascript" src="<?php echo $base_url ?>style/js/BE/datepicker/jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
    window.onload = function() {
        new JsDatePick({
            useMode: 2,
            target: "txt_create_date",
            dateFormat: "%Y-%m-%d",
            imgPath: "<?php echo $base_url ?>style/js/BE/datepicker/img/",
            /*selectedDate:{				This is an example of what the full configuration offers.
             day:5,						For full documentation about these settings please see the full version of the code.
             month:9,
             year:2006
             },
             yearsRange:[1978,2020],
             limitToToday:false,
             cellColorScheme:"beige",
             dateFormat:"%m-%d-%Y",
             imgPath:"img/",
             weekStartDay:1*/
        });

        var msg = "<?php echo $msg; ?>";
        if (msg != "")
            alert("<?php echo $msg; ?>");
    };
</script>
<!-- end   select date -->

<!-- begin search -->
<form name="trueform2" id="trueform2" method="POST" action="<?php echo $base_url; ?>admin_adv/search/" onSubmit="return submitSearch('<?php echo $base_url; ?>admin_adv/search/', 1);">
    <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#3D84CC" style="margin:auto; line-height:20px;">
        <tr>
            <td width="18%" bgcolor="#FFFFFF" class="title2">
                Tiêu đề:&nbsp;
                <input type="text" name="txt_title" id="txt_title" style="width:250px;" class="text1" value="<?php if (isset($txt_title)) echo $txt_title; ?>" maxlength="200" />     
                Ngày tạo:&nbsp;
                <input type="text" name="txt_create_date" id="txt_create_date" style="width:70px;" class="text1" value="<?php if (isset($txt_create_date)) echo $txt_create_date; ?>" maxlength="20"/>     
                &nbsp;Danh mục tin:&nbsp;
                <select name="cbo_adv_cate" id="cbo_adv_cate" class="text1">
                    <option value="">-- Tất cả --</option>
                    <?php foreach ($aAdvCate as $key => $item): ?>
                        <option value="<?php echo $item->cate_id; ?>" <?php if (isset($cbo_adv_cate) && $cbo_adv_cate == $item->cate_id) echo "selected='selected'"; ?>><?php echo $item->cate_name; ?></option>
                        <?php
                    endforeach;
                    ?>          
                </select>    
                <input type="hidden" name="isPost" value="1">
                <input type="hidden" name="h_cur_page" id="h_cur_page" value="">
                <input type="submit" name="btn_Search" id="btn_Search" value="Tìm kiếm" style="width:70px;" class="button2" />  
            </td>
        </tr>
    </table>
</form>
<!-- end   search -->
<div style="padding:12px;">Danh sách <?php echo $page_title; ?>:</div>
<div id="div_ajax_content" style="padding:0; margin:0;">
    <?php if (count($aAdv) > 0) { ?>
        <table width="98%" border="0" cellpadding="0" cellspacing="1" bgcolor="#3D84CC" style="margin:auto; line-height:20px;">
            <tr>
                <td width="3%" align="center" bgcolor="#3D84CC" class="title1">#</td>
                <td width="16%" align="center" bgcolor="#3D84CC" class="title1">Tiêu đề</td>
                <td width="10%" align="center" bgcolor="#3D84CC" class="title1">Tỉnh/TP</td>    
                <td width="10%" align="center" bgcolor="#3D84CC" class="title1">Danh mục</td>
                <td width="29%" align="center" bgcolor="#3D84CC" class="title1">Nội dung đăng</td>
                <td width="16%" align="center" bgcolor="#3D84CC" class="title1">Thông tin khác</td>
                <td width="6%" align="center" bgcolor="#3D84CC" class="title1">Trạng thái</td>
                <td width="8%" align="center" bgcolor="#3D84CC" class="title1">Thao tác</td>    
            </tr>
            <?php
            $i = 1;
            $bgcolor = "#FFFFFF";
            foreach ($aAdv as $key => $item):
                if ($i % 2 == 0) {
                    $bgcolor = "#EBF2F8";
                } else {
                    $bgcolor = "#FFFFFF";
                }
                ?>  
                <tr bgcolor="<?php echo $bgcolor; ?>">
                    <td width="3%" align="center" class="index" valign="top"><?php echo $i; ?></td>
                    <td width="16%" align="center" class="content" style="text-align:left;" valign="top">
                        <?php
                        if (isset($txt_title) && $txt_title != "")
                            echo str_ireplace($txt_title, "<span class='title8'>" . $txt_title . "</span>", $item->title);
                        else
                            echo $item->title;
                        ?><br />
                        <?php
                        if (isset($item->img_thumb) && $item->img_thumb != "") {
                            ?>
                            <a target="_new" href="<?php echo $base_url; ?>style/<?php echo $item->img; ?>" title="Click để xem hình lớn"><img src="<?php echo $base_url; ?>style/<?php echo $item->img_thumb; ?>" border="0" width="160"/></a>
                            <?php
                        }
                        ?>
                    </td>   
                    <td width="10%" align="center" class="content" style="text-align:left;" valign="top">
                        <?php
                        foreach ($aCity as $city) {
                            if ($item->city_id == $city->city_id) {
                                echo $city->city_name;
                            }
                        }
                        ?>
                    </td>    
                    <td width="10%" align="center" class="content" style="text-align:left;" valign="top">
                        <?php
                        echo $item->cate_name;
                        ?>
                    </td>     
                    <td width="29%" align="center" class="content" style="text-align:left;" valign="top">
                        <?php echo $item->desc; ?></td>	
                    <td width="16%" align="center" class="content" style="text-align:left;" valign="top">
                        * Họ tên: <strong><?php echo $item->user_full_name; ?></strong><br />
        <?php if ($item->tag != "") { ?>* Tag: <strong><?php echo $item->tag; ?></strong><br /><?php } ?> 
                        * Điện thoại: <?php echo $item->user_tel; ?><br />
                        * Ngày tạo: <?php echo $item->create_date; ?><br />
                        * IP người tạo: <span class="note"><?php echo $item->user_ip; ?></span>	
                    </td>	    
                    <td width="6%" align="center" class="content" style="text-align:center;" valign="top">
        <?php if ($item->status == "1")
            echo "Hiển thị"; else if ($item->status == "0")
            echo "Không hiển thị";
        ?></td>	
                    <td width="8%" class="content" style="text-align:center;" valign="top"><a href="<?php echo $base_url . $page_name; ?>/adv_edit/<?php echo $item->adv_id; ?>">Chỉnh sửa</a> | <a href="javascript:void(0);" onclick="del(<?php echo $item->adv_id; ?>)">Xóa</a></td>
                </tr>  
        <?php
        $i++;
    endforeach;
    ?>  
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td style="text-align:center;">
    <?php echo $paging; ?>     
                </td>
            </tr>
        </table>
        <input type="hidden" id="h_cur_page" value="<?php echo $cur_page; ?>" />
        <input type="hidden" id="h_Search" value="<?php echo "\$search"; ?>" />
    </div>
    <?php
} //if
else {
    ?>
    <table width="98%" border="0" cellpadding="0" cellspacing="1" style="margin:auto;">
        <tr>
            <td style="text-align:center;" height="60px">Không tìm thấy thông tin.</td>
        </tr>
    </table>  
    <?php
}
?>
<br /><br />
